/*
 * @Author: AskMeWhy
 * @Date: 2020-12-27 11:58:47
 * @Last Modified by: AskMeWhy
 * @Last Modified time: 2020-12-29 11:36:45
 */
const app = getApp();
const { AskComponent } = app._require("common/index");
const { downloadFile } = app._require("utils/download.file");
// 列表视频播放处理
// https://developers.weixin.qq.com/community/develop/doc/000e4ef22583d8961919efb6b56009
AskComponent({
    properties: {
        noHeader: {
            type: Boolean,
            value: false,
        },
        noFooter: {
            type: Boolean,
            value: false,
        },
    },
    data: {
        list: [
            {
                icon: "todo-list-o",
                label: "待办",
                dot: "",
                path: "/pages/home/index",
            },
            {
                icon: "user-o",
                label: "我的",
                dot: "",
                path: "/pages/personal/index",
            },
        ],
        active: "/pages/home/index",
    },
    lifetimes: {
        attached() {
            // 在组件实例进入页面节点树时执行
            // let pageList = getCurrentPages();
            // this.setData({
            //     active: "/" + pageList[pageList.length - 1].route,
            // });
        },
        detached() {
            // 在组件实例被从页面节点树移除时执行
        },
    },
    methods: {
        handleClick(e) {
            let { item } = e.currentTarget.dataset;
            let _url = item.path;
            // if (this.data.active === _url) {
            //     return;
            // }
            this.setData({
                active: _url,
            });
            wx.switchTab({
                url: _url,
            });
        },
    },
});
